package servidorapjava.transmissao;

import java.io.IOException;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoDataSourceException;
import javax.media.Processor;
import javax.media.protocol.DataSource;
import javax.media.protocol.SourceCloneable;

public class CapturaTransmissao {
    
    private DataSource dataSource;
    
    private MediaLocator mediaLocator;
    
    private CapturaTransmissao ct;
    
    public CapturaTransmissao(MediaLocator ml) {
        this.mediaLocator = ml;
        
    }
    
    public MediaLocator getLocator(){
        return mediaLocator;
    }
    
    public DataSource getDataSource() {
        
        if (dataSource == null){
            try {
                dataSource = Manager.createDataSource(mediaLocator);
            } catch (NoDataSourceException ex) {
                ex.printStackTrace();
                return null;
            } catch (IOException ex) {
                ex.printStackTrace();
                return null;
            }
            
//            return dataSource;
        }
        DataSource cloneableDataSource = null;
        DataSource clonedDataSource = null;
        
        cloneableDataSource = Manager.createCloneableDataSource(dataSource);
        clonedDataSource = ((SourceCloneable)cloneableDataSource).createClone();
        return clonedDataSource;
    }
    
    public Processor getProcessor(){
        if (dataSource == null){
            
        }
        return null;
    }
    
}
